<%@ page language="java" pageEncoding="GBK"%>
<%@ page import="java.sql.PreparedStatement"%>
<%@ page import="java.sql.ResultSet"%>
<%@ page import="java.io.PrintWriter"%>
<%@ page import="com.zjht.gmcc.bean.util.MyJDBC"%>
<%@ page import = "com.zjht.gmcc.bean.util.MySession"%>
<%@ page import = "com.zjht.gmcc.bean.util.Menu"%>
<html>
	<head>
		<title>tree</title>
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
	</head>
	<%
	
    	String menuid=Menu.SYS_PARAMETER_FRAMENEW;
	MyJDBC myJDBC=null;
	StringBuilder sb=null;
	try {
		if(!MySession.ValidSession(request, out, menuid))return;
		myJDBC=new MyJDBC();
		PreparedStatement ps = null;
		ResultSet Rs = null;
		PreparedStatement ps1 = null;
		ResultSet Rs1 = null;	
		
		response.setContentType("text/xml;charset=UTF-8");
		response.setHeader("Cache-Control", "no-cache");	
		sb = new StringBuilder();	
		sb.append("<root>"); 	
	
			String s_sql,s_sql1;
			String s_pid=request.getParameter("pId");
			if (s_pid.equals("0"))
			{									
				s_sql = "select paraid,paraname,status from parameter where parentid=0";
				ps = myJDBC.prepareStatement(s_sql);
				Rs = ps.executeQuery();			
				while (Rs.next())
				{					
					sb.append("<node id='"+Rs.getString(1)+"' hasChildren='0'>"+Rs.getString(2)+"</node>"); 
				}
				 Rs.close();
			}	
		}
		catch (Exception e) {
			e.printStackTrace();
			MySession.expAlert(request, out, menuid);
		} 
		finally
		{
			MyJDBC.close(myJDBC);
			sb.append("</root>");				
			PrintWriter out1=response.getWriter();
			out1.write(sb.toString());
			out1.close();					
		} 		
	%> 
<BODY>
</BODY>
</HTML>
